package cn.xiuxius.embedded.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.experimental.Accessors;

@Accessors(chain = true)
public class StringFlashOptionType extends AbstractFlashOptionType<String> {


    public StringFlashOptionType(String value, String cmdValue, boolean isDefault) {
        super(value, cmdValue, isDefault);
    }

    public StringFlashOptionType() {
    }

    public static final StringFlashOptionType DEFAULT = new StringFlashOptionType("default", "default", true);

    @JsonCreator
    public static StringFlashOptionType from(Object val) {
        if (val instanceof String s) {
            return new StringFlashOptionType(s, s, false);
        }
        throw new IllegalArgumentException("Unsupported BoolType input: " + val);
    }

    @Override
    public String getCmdValue() {
        return getValue().toLowerCase();
    }


    @Override
    public boolean isDefault() {
        return DEFAULT.equals(this);
    }


}
